<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?>
<?php

/**
 * helper for users
 * @author : lalene@advanzweb.com
 */

class User_helper{

	var $CI = null;

	public function __construct(){
        parent::__construct();
	}

	function getFullName( $id=null ){
		if(empty($id)) return false;
		$CI = &get_instance();
		$CI->load->model('Users_model','',TRUE);
		$qry = $CI->Users_model->getFullname( $id );
		if( !$qry->num_rows == 1 ){
			return false;
		}
		$user = $qry->result();
		$last = ($user[0]->lastname) ? ucfirst($user[0]->lastname). ', ': ucfirst($user[0]->lastname);
		$mid = ($user[0]->middle) ? ucfirst(substr($user[0]->middle,0,1)). '.': '';
		return $last.ucfirst($user[0]->firstname).' '.$mid;

	}

}